<template>
  <el-form>
    <el-form-item label="用户名" prop="username">
      <el-input type="text" v-model="credential.username"></el-input>
    </el-form-item>
    <el-form-item label="密码" prop="password">
      <el-input type="password" v-model="credential.password"></el-input>
    </el-form-item>
    <el-form-item>
      <el-button @click="onLoginButtonClick">登录</el-button>
    </el-form-item>
  </el-form>
</template>

<script setup>
import { ref } from 'vue';
import { useAuthStore } from '@/store/auth.store.js';

const credential = ref({
  username: '',
  password: ''
});

const authStore = useAuthStore();

function onLoginButtonClick() {
  authStore.login(credential.value);
}
</script>